function * createIdMaker() {
  let id = 0
  while(true){
    yield id++
  }
}
const idMaker = createIdMaker()

console.log(idMaker.next().value)
console.log(idMaker.next().value)
console.log(idMaker.next().value)
console.log(idMaker.next().value)